<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:param name="subcategory"/>
    <xsl:param name="category"/>
    <xsl:template match="/">
        <html>
            <head>
                <link rel="stylesheet" type="text/css" href="../css/style.css"/>
            </head>
            <body>
                <h2>List of goods in subcategory
                    <xsl:value-of select="$subcategory"/>:
                </h2>
                <div class="blockCenter">
                    <table border="1">
                        <tr>
                            <td>Name</td>
                            <td>Producer</td>
                            <td>Model</td>
                            <td>Date</td>
                            <td>Color</td>
                            <td>Price</td>
                            <td>In stock</td>
                        </tr>
                        <xsl:apply-templates/>
                    </table>
                    <br/>
                    <table>
                        <tr>
                            <td>
                                <form action="/servlet" method="post" class="buttonCenter">
                                    <input type="submit" name="command" value="BACK" class="button"/>
                                    <!--<input type="hidden" name="command" value="back"/>-->
                                    <input type="hidden" name="page" value="subcategoryList"/>
                                    <input type="hidden" name="category" value="{$category}"/>
                                </form>
                            </td>
                            <td>
                                <form action="/servlet" method="post" class="buttonCenter">
                                    <input type="submit" value="ADD" class="button"/>
                                    <input type="hidden" name="subcategory" value="{$subcategory}"/>
                                    <input type="hidden" name="category" value="{$category}"/>
                                    <input type="hidden" name="type" value="editXml"/>
                                    <input type="hidden" name="notForm" value="0"/>
                                    <input type="hidden" name="command" value="show"/>
                                </form>
                            </td>
                        </tr>
                    </table>
                </div>
            </body>
        </html>
    </xsl:template>
    <xsl:template match="subcategory">
        <xsl:if test="@name = $subcategory">
            <xsl:apply-templates select="goods"/>
        </xsl:if>
    </xsl:template>

    <xsl:template match="goods">
        <tr>
            <td>
                <xsl:value-of select="@name"/>
            </td>
            <td>
                <xsl:value-of select="producer"/>
            </td>
            <td>
                <xsl:value-of select="model"/>
            </td>
            <td>
                <xsl:value-of select="date"/>
            </td>
            <td>
                <xsl:value-of select="color"/>
            </td>
            <td>
                <xsl:choose>
                    <xsl:when test="notInStock">
                        -
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:value-of select="price"/>
                    </xsl:otherwise>
                </xsl:choose>
            </td>
            <td>
                <xsl:choose>
                    <xsl:when test="notInStock">
                        No
                    </xsl:when>
                    <xsl:otherwise>
                        Yes
                    </xsl:otherwise>
                </xsl:choose>
            </td>
        </tr>
    </xsl:template>
</xsl:stylesheet>